﻿using System;

namespace Syngine.Input
{
	/// <summary>
	/// 
	/// </summary>
	public class InputAction : IInputAction
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="InputAction"/> class.
		/// </summary>
		/// <param name="input">The input.</param>
		/// <param name="condition">The condition.</param>
		/// <param name="callback">The callback.</param>
		public InputAction(UserInput input, Func<IInputContext, bool> condition, IInputCallback callback)
		{
			Enabled = true;
			Input = input;
			Condition = condition;
			Callback = callback;
		}

		public bool Enabled { get; set; }

		public UserInput Input { get; private set; }

		public IInputCallback Callback { get; private set; }

		public Func<IInputContext, bool> Condition { get; private set; }

		/// <summary>
		/// Removes this instance from the input loop.
		/// </summary>
		public void Remove()
		{
			Input.Remove(this);
		}
	}
}